package model

import "github.com/zeromicro/go-zero/core/stores/sqlx"

var _ OneSayModel = (*customOneSayModel)(nil)

type (
	// OneSayModel is an interface to be customized, add more methods here,
	// and implement the added methods in customOneSayModel.
	OneSayModel interface {
		oneSayModel
		withSession(session sqlx.Session) OneSayModel
	}

	customOneSayModel struct {
		*defaultOneSayModel
	}
)

// NewOneSayModel returns a model for the database table.
func NewOneSayModel(conn sqlx.SqlConn) OneSayModel {
	return &customOneSayModel{
		defaultOneSayModel: newOneSayModel(conn),
	}
}

func (m *customOneSayModel) withSession(session sqlx.Session) OneSayModel {
	return NewOneSayModel(sqlx.NewSqlConnFromSession(session))
}
